//
//  XiaoXiAlertButtonView.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/30.
//  Copyright © 2019 SanYi. All rights reserved.
//

#import "XiaoXiAlertButtonView.h"



@implementation XiaoXiAlertButtonView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self initSubView];
        [self initOption];
    }
    return self;
}
- (void)initSubView{
    self.backgroundColor = [UIColor whiteColor];
    self.layer.cornerRadius = 5;
    self.layer.shadowColor = [UIColor darkGrayColor].CGColor;
    self.layer.shadowOffset = CGSizeMake(2, 2);
    self.layer.shadowRadius = 5;
    self.layer.shadowOpacity = 0.8;
    [self addSubview:self.dotButton];
    [self addSubview:self.deleteButton];
}
- (void)initOption{
    [_dotButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.top.equalTo(@0);
        make.bottom.equalTo(self.mas_centerY);
    }];
    [_deleteButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.top.equalTo(self.mas_centerY);
        make.bottom.equalTo(@0);
    }];
}

- (UIButton *)dotButton{
    if (!_dotButton) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        [button setImage:[UIImage imageNamed:@"menu_buke"] forState:UIControlStateNormal];
        [button addTarget:self action:@selector(dotButtonClick) forControlEvents:UIControlEventTouchUpInside];
        _dotButton = button;
    }
    return _dotButton;
}
- (void)dotButtonClick{
    [self removeFromSuperview];
}
- (UIButton *)deleteButton{
    if (!_deleteButton) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        [button setTitle:@"删除" forState:UIControlStateNormal];
        [button setTitleColor:SELECTEDCOLOR forState:UIControlStateNormal];
        [button addTarget:self action:@selector(deleteButtonClick) forControlEvents:UIControlEventTouchUpInside];
        _deleteButton = button;
    }
    return _deleteButton;
}
- (void)deleteButtonClick{
    
}
@end
